#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>



int main() {
    int n;
    int i = 0;
    int m;
    int k = 0;
    int max = -1;
    int min = 101;

    int j = 0;
    scanf("%d\n", &n);
    while (i < n) {
        scanf("%d ", &m);
        if (min >= m)
        {
            min = m;
        }
        if (max <= m) {
            max = m;
        }

        i++;

    }
   /* while (j < n) {
        if (max <= m) {
            max = m;
        }
        j++;



    }*/
    /*int min = arr[0];
    while (k < n)
    {
        if (min >= m)
        {
            min = m;
        }
        k++;
    }*/

    printf("%d", max - min);



    return 0;
}